#pragma once

class SShape
{
public:
	virtual SShape * Clone() const = 0;
};

class SPoint : public SShape
{
public:
	SPoint() { x = 0; y = 0;}
	SPoint(int nx, int ny) { x = nx; y = ny;}
	void SetPoint(int nx, int ny) { x = nx; y = ny;}
	virtual SShape * Clone() const;

public:
	int x;
	int y;
};
class SSize : public SShape
{
public:
	SSize() { cx = 0; cy = 0;}
	SSize(int nx, int ny) { cx = nx; cy = ny;}
	void SetSize(int nx, int ny) { cx = nx; cy = ny;}
	virtual SShape * Clone() const;
	SIZE ToSIZE() const;

public:
	int cx;
	int cy;
};
class SLine : public SShape
{
public:
	SLine() { cx = 0; cy = 0;}
	SLine(int nx, int ny) { cx = nx; cy = ny;}
	void SetLine(int nx, int ny) { cx = nx; cy = ny;}
	virtual SShape * Clone() const;

public:
	int cx;
	int cy;
};
class SRect : public SShape
{
public:
	SRect() { left = 0; right = 0; right = 0; bottom = 0; }
	SRect(int nleft, int ntop, int nright, int nbottom) { left = nleft, top = ntop; right = nright; bottom = nbottom;}
	SRect(RECT rc) { left = rc.left; top = rc.top; right = rc.right; bottom = rc.bottom; }
	void SetRect(int nleft, int ntop, int nright, int nbottom) { left = nleft, top = ntop; right = nright; bottom = nbottom;}
	virtual SShape * Clone() const;
	int Width() const { return right - left;}
	int Height() const { return bottom - top;}
	RECT ToRECT() const;
	SPoint CenterPoint() const;
	bool PtInRect(SPoint pt)
	{
		return pt.x >= left && pt.x <= right && pt.y >= top && pt.y <= bottom;
	}

	bool operator==(const SRect rc);
	bool operator==(const RECT rc);
	bool operator!=(const SRect rc);
	bool operator!=(const RECT rc);
	SRect operator+(const int nSize);
	SRect operator-(const int nSize);

public:
	int left;
	int top;
	int right;
	int bottom;
};